package org.ricks.log;

/**
 * @author chenwei
 * @Title:
 * @Package
 * @Description:
 * @date 2021/1/2917:46
 */
public interface Policy {

    /**
     * Checks if an existing log file can be continued.
     *
     * @param path
     *            Path to log file
     * @return {@code true} if existing log file can be continued, {@code false} if a new log file should be created
     */
    boolean continueExistingFile(String path);

    /**
     * Checks if a log entry can be appended to the current log file.
     *
     * @param entry
     *            Log entry
     * @return {@code true} if log entry can be appended to the current log file, {@code false} if a new log file should
     *         be created
     */
    boolean continueCurrentFile(byte[] entry);

    /**
     * Resets this policy as a new log file has been started.
     */
    void reset();

}
